<template>
  <div class="mod-config">
    <el-table
      :data="datadispatchList"
      border
      v-loading="datadispatchListLoading"
      @selection-change="selectionChangeHandle"
      style="width: 100%;">
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        width="50">
      </el-table-column>
      <el-table-column
        prop="id"
        header-align="center"
        align="center"
        label="取件作业">
      </el-table-column>
      <el-table-column
        prop="transportorderid"
        header-align="center"
        align="center"
        label="运单编号">
      </el-table-column>
      <el-table-column
        prop="assignedStatus"
        header-align="center"
        align="center"
        label="快递员分配状态">
        <tmplate slot-scope="scope">
          <span>{{ scope.row.assignedStatus == 1 ? "未分配" :scope.row.assignedStatus==2?"已分配":"待人工分配"  }}</span>
        </tmplate>
      </el-table-column>
      <el-table-column
        prop="ordercreatetime"
        header-align="center"
        align="center"
        label="下单时间">
      </el-table-column>
      <el-table-column
        prop="status"
        header-align="center"
        align="center"
        label="作业状态">
        <tmplate slot-scope="scope">
          <span>{{ scope.row.status == 1 ? "待提货" :scope.row.status==2?"在途中":scope.row.status==4?"已交付":"已取消"  }}</span>
        </tmplate>
      </el-table-column>
      <el-table-column
        prop="courier"
        header-align="center"
        align="center"
        label="快递员姓名">
      </el-table-column>
      <el-table-column
        prop="sendername"
        header-align="center"
        align="center"
        label="发件人姓名">
      </el-table-column>
      <el-table-column
        prop="senderphone"
        header-align="center"
        align="center"
        label="发件人电话">
      </el-table-column>
      <el-table-column
        prop="senderaddress"
        header-align="center"
        align="center"
        label="发件人地址">
      </el-table-column>
      <el-table-column
        prop="estimatedStartTime"
        header-align="center"
        align="center"
        label="计划取件时间">
      </el-table-column>
      <el-table-column
        prop="actualEndTime"
        header-align="center"
        align="center"
        label="完成时间">
      </el-table-column>
<!--      <el-table-column
        fixed="right"
        header-align="center"
        align="center"
        width="150"
        label="操作">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
          <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>-->
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
  </div>
</template>

<script src="src/api/work.js"></script>
<script>
  import {getCTaskPickupdispatchList} from "@/api/work";
  export default {
    data () {
      return {
        datadispatchList: [],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        datadispatchListLoading: false,
        datadispatchListSelections: [],
      }
    },
    mounted() {
      this.getDatapickupList();
    },
    methods: {
      // 获取数据列表
      getDatapickupList () {
        this.datadispatchListLoading = true

        getCTaskPickupdispatchList().then(({data}) => {
          if (data && data.code == 0) {
            this.datadispatchList = data.page.rows
            this.totalPage = data.page.total
          } else {
            this.dataList = []
            this.totalPage = 0
          }

          this.datadispatchListLoading = false
        })
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDatadispatchList()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDatadispatchList()
      },
      // 多选
      selectionChangeHandle (val) {
        this.datadispatchListSelections = val
      }
    }
  }
</script>
